<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/views1/DTD/views1-transitional.dtd">
<f:view xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.prime.com.tr/ui">
	<ui:composition template="/views/layout/main.xhtml">
		<ui:define name="conteudo">
			<h:form id="formPrincipal">
				<div class="grid_18 div_48">
					<p:commandButton value="Home" style="float: right;" ajax="false" action="#{realizarProvaBean.goHome}" title="Home" />
					<p:commandButton type="button" onclick="promptBuscaProvas.show();" value="Filtrar" />
					<p:commandButton rendered="#{realizarProvaBean.podeRealizarProva}" ajax="false" action="#{realizarProvaBean.visualizarResultado}" value="Visualizar Resultado" />
					<p:commandButton rendered="#{realizarProvaBean.podeVerResultado}" ajax="false" action="#{realizarProvaBean.realizarProva}" value="Reponder Perguntas" />
				</div>

				<div class="grid_18 titulo">Minhas Provas</div>

				<div class="grid_18">
					<p:messages redisplay="false" id="messages" showDetail="true"/>
				</div>
				
				<div class="grid_18">
					<p:dataTable var="model" paginator="true" rows="10" paginatorPosition="top"
								id="gridProvas" value="#{realizarProvaBean.provaList}"
								selectionMode="single" selection="#{realizarProvaBean.provaInstance}" update="formPrincipal"
								rowUnselectListener="#{realizarProvaBean.rowUnSelectProvas}" onRowUnselectUpdate="formPrincipal">
						<p:column headerText="Disciplina"
							style="width: 130px;">
							<h:outputText value="#{model.aplicadaEm.disciplina.nome}"/>
						</p:column>
						
						<p:column headerText="Professor"
							style="width: 130px;">
							<h:outputText value="#{model.aplicadaEm.professor.nomeCompleto}"/>
						</p:column>
						
						<p:column headerText="Semestre"
							style="width: 50px;">
							<h:outputText value="#{model.aplicadaEm.ano}">
								<f:convertDateTime pattern="yyyy"/>
							</h:outputText>
							<h:outputText value="/"/>
							<h:outputText value="#{model.aplicadaEm.semestre}"/>
						</p:column>
						
						<p:column headerText="Início"
							style="width: 135px;">
							<h:outputText value="#{model.dataHoraInicio}">
								<f:convertDateTime pattern="dd/MM/yyyy - HH:hh"/>
							</h:outputText>
						</p:column>
						
						<p:column headerText="Fim"
							style="width: 135px;">
							<h:outputText value="#{model.dataHoraFim}">
								<f:convertDateTime pattern="dd/MM/yyyy - HH:hh"/>
							</h:outputText>
						</p:column>
					</p:dataTable>
				</div>

			</h:form>
			<ui:include src="/views/realizarProva/_filtrar.xhtml"/>
		</ui:define>
	</ui:composition>
</f:view>